The present invention relates to computer graphics, and more particularly to accessing texture data for texture mapping during computer graphics processing.
Recent advances in computer performance have enabled graphic systems to provide more realistic graphical images using personal computers and home video game computers. In such graphic systems, some procedure must be implemented to xe2x80x9crenderxe2x80x9d or draw graphic primitives to the screen of the system. A xe2x80x9cgraphic primitivexe2x80x9d is a basic component of a graphic picture, such as a polygon, e.g., a triangle, or a line. All graphic pictures are formed with combinations of these graphic primitives. Many procedures may be utilized to perform graphic primitive rendering.
Early graphic systems displayed images representing objects having extremely smooth surfaces. That is, textures, bumps, scratches, or other surface features were not modeled. In order to improve the quality of the image, texture mapping was developed to model the complexity of real world surface images. In general, texture mapping is the mapping of an image or a function onto a surface in three dimensions. Texture mapping is a relatively efficient technique for creating the appearance of a complex image without the tedium and the high computational cost of rendering the actual three dimensional detail that might be found on a surface of an object. In texture mapping, a source image known as the xe2x80x9ctexturexe2x80x9d is mapped onto a surface in three dimensional space. The three dimensional surface is then mapped to the destination image. The destination image is then displayed on a graphic display screen. Examples of the texture of an object include the gravel on a highway or scuff marks on a wooden surface.
Many parameters have been texture mapped in conventional systems. Some of these parameters include surface color, specular reflection, normal vector perturbation, specularity, transparency, diffuse reflections, and shadows. In all of these cases, the texture map contains numerical values representing these parameters, stored in tabular form.
The number of indices used to access this table can vary. The number of indices used is defined as the dimensionality of the texture map. A one-dimensional texture is a function of a single index f(x). A two-dimensional texture is a function of two indices g(x, y). A three-dimensional texture is a function of three indices h(x, y, z). And so forth. The invention applies to three-dimensional and higher-dimensional textures.
Prior art FIG. 1 illustrates a three-dimensional texture map 100 that may be used during the texturing process. As shown, the texture map 100 includes a plurality of components, or texels 102,which form a three-dimensional grid. Such texels 102 extend in three directions, namely a x, y, and z direction. Each texel 102 contains the various parameters set forth earlier which aid in generating a realistic image.
During use, the various texels 102 of the texture map 100 are retrieved from memory as they are needed for mapping onto a surface in three-dimensional space. Often, the texels 102 are grouped into a fixed number of blocks which are in turn compressed. Compression generally reduces the amount of memory used to store the texture map 100 and also reduces the memory bandwidth used to access it. When such compression technique is employed, the entire block is first retrieved and decompressed after which the texels 102 are accessed for mapping purposes.
Prior art FIG. 2 illustrates the texture map 100 with the texels 102 being grouped into blocks 200-207 which have dimensions of four (4) texels by four (4) texels by four (4) texels. Each block 200-207 of texels 102 is positioned in one of a plurality of image block planes a, b, . . . which are spaced along the z-axis. In other words, the image planes differ in depth within the texture map 100.
With continuing reference to prior art FIG. 2, the manner in which the blocks 200-207 of texels 102 are traditionally stored in linear memory 208 is shown. The blocks 200-207 of image block planes a and b are compressed, and the compressed data is positioned contiguously in linear memory 208 in the corresponding blocks 200a-207c. In use, for example, block 200c may be retrieved from the linear memory 208 using an appropriate address. Thereafter, block 200c may be decompressed after which the texels 102 are retrieved for mapping purposes.
A significant problem associated with the system of prior art FIGS. 1-2 arises since this technique assumes that each image block plane has representative texels 102 in each of the blocks 200-207.Since this is often an erroneous assumption, this frequently results in a waste of memory space. By way of example, if the texture map 100 were only 2 texels deep, then half of the space of the blocks 200-203 would be unused.
Another significant problem associated with prior art as described in FIG. 2 is that the entire compressed block, 200c for example, needs to be retrieved in order to access any texels 102 within that block.
Yet another significant problem associated with prior art as described in FIG. 2 is that prior art generally defines a compression format for three-dimensional texture maps that is different enough from the compression format for two-dimensional texture maps that separate hardware needs to be built for the two formats.
There is therefore a need for a data structure and associated method of retrieval that requires less memory space, allows for more efficient retrieval of texture data during the texture mapping process, and requires less hardware overall.
A system, method and article of manufacture are provided for efficient storage of texture data in memory for use with a computer graphics pipeline. Provided is a data structure including at least one compressed sub-block representing a group of texels in a predetermined image plane and at predetermined locations in a first and a second dimension in a texture map. The number of sub-blocks is based on the depth of texture data in the texture map.
By allowing the versatile selection of the number of sub-blocks in the foregoing manner, a minimal required amount of sub-blocks need only be employed. This avoids wasted memory space which occurs when a predetermined, fixed number of sub-blocks is universally used. The present invention thus exploits the absence of texels in various dimensions of the texture map, and specifically tailors a depth of the sub-blocks to conform to the particular nature of the texture map.
In one embodiment of the present invention, the group of texels in the sub-block includes no more than four (4) texels in the first dimension, four (4) texels in the second dimension, and one (1) texel in the third dimension. Further, the number of sub-blocks in a block may include one (I), two (2), three (3), or four (4).
In another embodiment of the present invention, the sub-blocks together define a memory block with an associated block address. Still yet, the sub-blocks may each have an associated sub-block address. This allows each memory sub-block to be retrieved and decompressed individually. This may be accomplished using hardware equipped to decompress two-dimensional texture data.
In another embodiment of the present invention, a method is provided for efficient retrieval of texture data utilizing a data structure as set forth above. Such method first includes computing texture coordinates corresponding to predetermined texels required for performing texture operations in a computer graphics pipeline. Thereafter, an address is computed associated with at least one of the compressed sub-blocks associated with the texture coordinates. Further, at least one compressed sub-block is retrieved using the address. Thereafter, the retrieved compressed sub-block(s) is decompressed for accessing the predetermined texels.
These and other advantages of the present invention will become apparent upon reading the following detailed description and studying the various figures of the drawings.